/*
 * @Author: szx
 * @Date: 2022-03-26 14:32:26
 * @LastEditTime: 2022-03-26 14:38:00
 * @Description:
 * @FilePath: \leetcode\500-599\518\518_2.js
 */
/**
 * @param {number} amount
 * @param {number[]} coins
 * @return {number}
 */
var change = function (amount, coins) {
    const dp = new Array(amount + 1).fill(0);
    dp[0] = 1;
    for (let i = 0; i < coins.length; i++) {
        for (let j = coins[i]; j <= amount; j++) {
            dp[j] += dp[j - coins[i]];
        }
    }
    return dp[amount];
};
